<%@ page import="com.psl.model.userlogin" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    userlogin userinfo = (userlogin) session.getAttribute("user");
    if (userinfo == null) {
        response.sendRedirect("/login.do");
    }%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="/assets/css/text.css" rel="stylesheet" type="text/css">
    <link href="/assets/css/main.css" rel="stylesheet" type="text/css">
    <link href="/assets/css/content.css" rel="stylesheet" type="text/css">
    <script language="javascript" src="/assets/js/common.js"></script>
    <script language="javascript" src="/assets/js/general.js"></script>
    <script language="JavaScript" type="text/JavaScript">
    </script>
    <style>
        #title {
            width: 92%;
            border: 0px;
            margin-bottom: 10px;
        }

        #title td {
            text-align: center;
            height: 20px;
            line-height: 150%
        }

        #title div {
            background-image: url(/assets/img/dot_02.gif);
            background-position: left top;
            background-repeat: no-repeat;
            margin: 0 auto;
            padding-left: 20px;
            text-align: left;
            width: 10%;
            font-size: 15px;
            font-weight: bold;
            color: #CC0000;
            letter-spacing: 2px;
        }
    </style>
    <script>
        function sum() {
            var id = document.getElementById("");
            alert(id);
        }
    </script>
</head>
<body>

<table cellspacing="0" cellpadding="0" id="title" align="center">
    <tbody>
    <tr>
        <td nowrap="nowrap">
            <div> 采购</div>
        </td>
    </tr>
    </tbody>
</table>

<table cellspacing="0" cellpadding="0" class="datalist" align="center">
    <tbody>
    <tr>
        <th align="center">选择</th>
        <th align="center">序号</th>
        <th align="center">耗材品名</th>
        <th height="25" align="center">数量及单位</th>
        <th height="25" align="center">单价</th>
        <th height="25" align="center">总金额</th>
        <th height="25" align="center">类型</th>
        <th align="center">日期</th>
        <th align="center">操作</th>
    </tr>
    <form action="/addmoney.do" method="post">
        <tr>
            <td align="center">全选：<input type="checkbox" name="check" id="check" onclick="CheckAll()" ></td>
            <td align="center"></td>
            <td align="center"><input name="name" type="text" value=""/></td>
            <td align="center"><input name="num" type="text" value="" placeholder="数量"/>&nbsp;&nbsp;
                <input type="text" value="" name="unit" placeholder="单位">
            </td>
            <td align="center"><input name="money" type="text" value=""/></td>
            <td align="center"></td>
            <td align="center">
                <select name="type">
                    <option value="0">请选择类型</option>
                    <option value="1">车间采购</option>
                    <option value="2">办公室采购</option>
                    <option value="3">伙房采购</option>
                </select>
            </td>
            <td align="center"><input name="date" type="date" value=""/></td>
            <td align="center"><input type="submit" value="保存"/></td>
        </tr>
    </form>

    <c:forEach items="${money}" var="ml">
        <form name="form">
        <tr>
            <td height="25" align="center"><input type="checkbox" name="check" id="check" onclick="sum()"></td>
            <td height="25" align="center">${ml.id}
            </td>
            <td height="25" align="center">${ml.name}
            </td>
            <td height="25" align="center">${ml.num} ${ml.unit}
            </td>
            <td height="25" align="center">${ml.money}
            </td>
            <td height="25" align="center">
                <input type="hidden" name="" value="<fmt:formatNumber value="${ml.num * ml.money}" type="currency" pattern=".00"/>"/>
                <fmt:formatNumber value="${ml.num * ml.money}" type="currency" pattern=".00"/>
            </td>
            <td height="25" align="center">
                <c:choose>
                    <c:when test="${ml.type=='1'}">
                        车间采购
                    </c:when>
                    <c:when test="${ml.type=='2'}">
                        办公室采购
                    </c:when>
                    <c:when test="${ml.type=='3'}">
                        伙房采购
                    </c:when>
                </c:choose>
            </td>
            <td height="25" align="center">${ml.date}</td>
            <td height="25" align="center"><a href="/delmoney.do?id=${ml.id}"><img src="/assets/img/icodelete.gif"></a></td>
        </tr>
        </form>
    </c:forEach>
    <c:forEach items="${All}" var="tl">
        <tr>
            <td height="25" align="center" colspan="4">
            </td>
            <td height="25" align="center">${tl.money}</td>
            <td height="25" align="center" colspan="2"></td>
        </tr>
    </c:forEach>
    </tbody>
</table>
</body>
</html>